[comment {-*- tcl -*- doctools manpage}]
[manpage_begin TclJsPac n 0.1]
[copyright {2006-2007 Jos Decoster <jos.decoster@gmail.com>}]
[moddesc {Tcl extension to evaluate proxy.pac files using TclJs}]
[titledesc {Tcl extension to evaluate proxy.pac files using TclJs}]
[require Tcl 8.4]
[require TclJs 0.1]
[require dns 1.3.1]
[require ip 1.1.1]
[require udp (Optionally)]
[description]

[para] 

This extension makes it possible to evaluate [term proxy.pac] files using the
[package TclJs] package. To do so, some predefined JavaScript functions are
required. The Tcl [package TclJsPac] package provides these functions.

[section COMMANDS]

The commands below are required to evaluate [term proxy.pac] files. They have 
to be registerd as functions in a JavaScript interpreter before evaluating
[term proxy.pac] files. Registering can be done using the 
[cmd ::js::pac::addToJsInterp] command. More information about [term proxy.pac]
files and about these commands can be found here:

[para]
[uri http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html]

[para]
Some commands have a [arg day] argument. This must be specified as a integer 
from 1 to 31.

[para]
Some commands have a [arg week] argument. This must be specified with one of 
the  following 3 letter abreviations: [const SUN], [const MON], [const TUE], 
[const WED], [const THU], [const FRI] or [const SAT].

[para]
Some commands have a [arg month] argument. This must be specified with one of 
the following 3 letter abreviations: [const JAN] [const FEB] [const MAR] 
[const APR] [const MAY] [const JUN] [const JUL] [const AUG] [const SEP] 
[const OCT]  [const NOV] [const DEC].

[para]
Some commands have a [arg year] argument. This must be specified as a 4 digit 
year (e.g. 2007, 1999, ...). 

[para]
Several of these commands have a optional [arg gmt] argument. When [arg gmt] 
has  the value [const GMT], times are relative to Greenwich Mean Time. When 
[arg gmt]  is not specified or has the value [const LOC], local times are used.

[para] 
Host names, domain names, abbreviations used to specify days of the week or
months and abbreviations to specify Greenwich Mean Time or local time are case
insensitive.

[list_begin definitions]

[call [cmd ::js::pac::isPlainHostName] [arg host]]

True if there is no domain name in [arg host] (no dots).

[call [cmd ::js::pac::dnsDomainIs] [arg host] [arg domain]]

Returns true if the domain of [arg host] matches [arg domain].

[call [cmd ::js::pac::localHostOrDomainIs] [arg host] [arg hostdom]]

Is true if the [arg host] matches exactly [arg hostdom], or if there is no 
domain  name part in [arg host], but the unqualified [arg host] matches the 
host name in  [arg hostdom].

[call [cmd ::js::pac::isResolvable] [arg host]]

Tries to resolve [arg host]. Returns true if succeeds.

[call [cmd ::js::pac::isInNet] [arg host] [arg pattern] [arg mask]]

True if the IP address of [arg host] matches the specified [arg pattern] after 
applying [arg mask].

[call [cmd ::js::pac::dnsResolve] [arg host]]

Resolves the given DNS [arg host] into an IP address, and returns it in the dot
separated format as a string.

[call [cmd ::js::pac::myIpAddress]]

Returns the IP address of the host as a string in the dot-separated integer 
format.

[call [cmd ::js::pac::dnsDomainLevels] [arg host]]

Returns the number (integer) of DNS domain levels (number of dots) in 
[arg host].

[call [cmd ::js::pac::shExpMatch] [arg str] [arg shexp]]

Returns true if [arg str] matches the specified shell expression [arg shexp]. 
Matching is done using [cmd {string match}].

[call [cmd ::js::pac::weekdayRange] [arg weekDay] [opt [arg gmt]]]

Returns true if the current day is the specified day.

[call [cmd ::js::pac::weekdayRange] [arg weekDayFrom] [arg weekDayTo] [opt [arg gmt]]]

[call [cmd ::js::pac::dateRange] [arg day] [opt [arg gmt]]]

[call [cmd ::js::pac::dateRange] [arg dayFrom] [arg dayTo] [opt [arg gmt]]]

[call [cmd ::js::pac::dateRange] [arg month] [opt [arg gmt]]]

[call [cmd ::js::pac::dateRange] [arg monthFrom] [arg monthTo] [opt [arg gmt]]]

[call [cmd ::js::pac::dateRange] [arg year] [opt [arg gmt]]]

[call [cmd ::js::pac::dateRange] [arg yearFrom] [arg yearTo] [opt [arg gmt]]]

[call [cmd ::js::pac::dateRange] [arg day] [arg month] [opt [arg gmt]]]

[call [cmd ::js::pac::dateRange] [arg dayFrom] [arg monthFrom] [arg dayTo] [arg monthTo] [opt [arg gmt]]]

[call [cmd ::js::pac::dateRange] [arg month] [arg year] [opt [arg gmt]]]

[call [cmd ::js::pac::dateRange] [arg monthFrom] [arg yearFrom] [arg monthTo] [arg yearTo] [opt [arg gmt]]]

[call [cmd ::js::pac::dateRange] [arg dayFrom] [arg monthFrom] [arg yearFrom] [arg dayTo] [arg monthTo] [arg yearTo] [opt [arg gmt]]]

[call [cmd ::js::pac::timeRange] [arg hour] [opt [arg gmt]]]

[call [cmd ::js::pac::timeRange] [arg hourFrom] [arg hourTo] [opt [arg gmt]]]

[call [cmd ::js::pac::timeRange] [arg hourFrom] [arg minuteFrom] [arg hourTo] [arg minuteTo] [opt [arg gmt]]]

[call [cmd ::js::pac::timeRange] [arg hourFrom] [arg minuteFrom] [arg secondFrom] [arg hourTo] [arg minuteTo] [arg secondTo] [opt [arg gmt]]]

[call [cmd ::js::pac::addToJsInterp] [arg jsInterp]]

Adds all commands listed above to the specified JavaScript interpreter 
[arg jsInterp] with function names and returns type as needed to evaluate 
[term proxy.pac] files.

[list_end]

[keywords JavaScript SpiderMonkey proxy.pac]
[manpage_end]
